package ControlLayer;
import ModelLayer.*;
import java.util.HashMap;
import java.util.Iterator;

/**
 * Controller class for the address book
 * 
 * @author (Group 1) 
 * @version (2013.11.04)
 */
public class AddressCtr
{
    private AddressBook addrBook;
    private static AddressCtr instance = null;
    
    private AddressCtr() { addrBook = AddressBook.getInstance(); }
    public static AddressCtr getInstance()  {  if(instance==null) instance = new AddressCtr();   return instance;  }

    // return a Person object
    public Person getPerson(long id)
    {
        return addrBook.getPerson(id);
    }
    
    public void createPerson(long id, String name, String address, String postalCode, String city, String phone)
    {   
        addrBook.createPerson(id, name, address, postalCode, city, phone);
    }
    

    public boolean deletePerson(long id)
    {
        return addrBook.deletePerson(id);
    }

    public boolean updatePerson(long id,int choice, String updateValue)
    {
        return addrBook.updatePerson(id, choice, updateValue);
    }

    public Iterator listAllPersons()
    {
        return addrBook.listAllPersons();
    }
}
